package com.example.tvwanandroid.presenter

import com.example.tvwanandroid.base.BaseListResult
import com.example.tvwanandroid.base.BaseObserver
import com.example.tvwanandroid.base.BasePresenter
import com.example.tvwanandroid.bean.SearchBean
import com.example.tvwanandroid.view.SearchResultView

/**
 * @作者: njb
 * @时间: 2020/12/8 14:34
 * @描述:
 */
class SearchResultPresenter(baseView: SearchResultView): BasePresenter<SearchResultView>(baseView) {
    fun getQuery(page:Int,k:String){
        addDisposable(apiServer.query(page,k),object : BaseObserver<BaseListResult<SearchBean>>(baseView){
            override fun onSuccess(o: BaseListResult<SearchBean>) {
                baseView.onLoadSearcher(o.data!!)
            }

            override fun onError(msg: String?) {
                baseView.showError(msg!!)
            }

        })
    }
}